package org.redis.cluster.transport;

import java.util.HashMap;
import java.util.Map;

import org.redis.cluster.transport.session.SessionContext;

public class DefaultSessionContext implements SessionContext {
	
	private final Map<Object,Object> contextMap=new HashMap<Object,Object>();

	@Override
	public boolean put(Object key, Object value) {
		return (contextMap.put(key, value)==null);
	}

	@Override
	public <T> T get(Object key) {
		return (T) contextMap.get(key);
	}

	@Override
	public boolean remove(Object key) {
		return contextMap.remove(key)!=null;
	}

	@Override
	public boolean clean() {
		contextMap.clear();
		return true;
	}

}